********************************************************************************
* All states
********************************************************************************

use dataset_donors, clear

eststo clear
eststo: areg ltotamount anywells i.year, a(zipcode) cl(zipcode)
estadd local ZFE = "Yes"
estadd local YFE = "Yes"
forvalues x = 2000(2)2010 {
	eststo, title("> `x'"): areg ltotamount anywells i.year ///
		if year > `x', a(zipcode) cl(zipcode)
	estadd local ZFE = "Yes"
	estadd local YFE = "Yes"
}

label variable anywells "Any wells"

#delimit;

esttab 
	using "_output/tableA17a.tex"
	,
		replace
		booktabs
		drop(*year* _cons)
		cells(b(fmt(3) star) se(par))
		compress
		label
		gap
		collabels(none)
		mtitles("All years" "> 2000")
		width(\linewidth)
		stats(
			YFE
			ZFE
			N_clust
			N
			,
				label(
					"Year fixed effects"
					"Zip code fixed effects" 
					"Clusters"
					"Observations"
				)
				fmt(0 %20.0fc)
		)
		;
	
#delimit cr

********************************************************************************
* High-fracking states
********************************************************************************

keep if highf == 1

eststo clear
eststo: areg ltotamount anywells i.year, a(zipcode) cl(zipcode)
estadd local ZFE = "Yes"
estadd local YFE = "Yes"
forvalues x = 2000(2)2010 {
	eststo, title("> `x'"): areg ltotamount anywells i.year ///
		if year > `x', a(zipcode) cl(zipcode)
	estadd local ZFE = "Yes"
	estadd local YFE = "Yes"
}

label variable anywells "Any wells"

#delimit;

esttab 
	using "_output/tableA17b.tex"
	,
		replace
		booktabs
		drop(*year* _cons)
		cells(b(fmt(3) star) se(par))
		compress
		label
		gap
		collabels(none)
		mtitles("All years" "> 2000")
		width(\linewidth)
		stats(
			YFE
			ZFE
			N_clust
			N
			,
				label(
					"Year fixed effects"
					"Zip code fixed effects" 
					"Clusters"
					"Observations"
				)
				fmt(0 %20.0fc)
		)
		;
	
#delimit cr

********************************************************************************
* End
********************************************************************************
